<?php
namespace app\admin\controller;

use app\admin\logic\OrderLogic;
use app\BaseController;
use think\facade\Request;
use think\facade\View;

class Order extends BaseController {
    //order订单列表页
     public function orderList(){
         //order 订单where语句拼接
         $where=OrderLogic::orderWhere();
        //order 订单留值
         $data=OrderLogic::orderData();
         View::assign($data);
         //order订单状态
         $ostatus=\app\admin\model\Order::orderStatus();
         View::assign('ostatus',$ostatus);
         //订单列表语句
        $order=\app\admin\model\Order::ordersList($where,$data);
        $page=$order->render();
            View::assign(['order'=>$order,'page'=>$page]);
          return View::fetch();
     }

        //order 订单删除页(软删除)
      public function orderDel(){
        $get=Request::get();
        $res=\app\admin\model\Order::orderDel($get);
        if ($res){
            $this->success('删除成功',url('orderList'));
        }else{
            $this->error('删除失败');
        }
       }

       //order 订单删除页(多软删)
     public function orderAllDel(){
         $get=Request::get();
         $res=\app\admin\model\Order::orderAllDel($get);
         if ($res){
             $this->success('删除成功',url('orderList'));
         }else{
             $this->error('删除失败');
         }
     }

       //order  订单回收站
     public function orderRecycle(){
         $list=\app\admin\model\Order::orderRecycle();
          View::assign('list',$list);
          return View::fetch();
      }

     //回收站删除
     public function recycleDel(){
            $get=Request::get();
            $res=\app\admin\model\Order::orderHuiDel($get);
         if ($res){
             $this->success('删除成功',url('orderRecycle'));
         }else{
             $this->error('删除失败');
         }
      }

      //回收站恢复
       public function recyclehuifu(){
           $get=Request::get();
           $res=\app\admin\model\Order::orderHuiFu($get);
           if ($res){
               $this->success('恢复成功',url('orderList'));
           }else{
               $this->error('恢复失败');
           }

            return View::fetch();
        }
     //order 订单详情页
      public function orderDetail(){
           return View::fetch();
       }


}